<?php
/**
 * Created by PhpStorm.
 * User: DELL
 * Date: 2018/7/12
 * Time: 19:43
 */
namespace app\api\controller\v1;
use app\api\controller\Common;
use app\common\lib\Aes;
use app\common\lib\exception\ApiException;

class Cat extends Common
{

   public function read()
   {
        $cats = config('cat.lists');
        $result[] = [                       //这样定义数组就成为了二维数组
            'catid' => 0,
            'catname'=>'首页'
        ];

        foreach($cats as $catid=>$catname)
        {
            $result[] = [
              'catid' => $catid,
              'catname'=>$catname
            ];
        }
        //这里的status码也可以从code配置项里拿,但是我个人觉得没多少用
        return show(1,'ok',$result,200);
   }
}